package com.tangdi.Action;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;

import com.tangdi.Bean.CZGZ_DWXX_TOTAL;
import com.tangdi.Dao.impl.GongziDWImpl; 

public class checkDF_Total_InfoAction  extends HttpServlet{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Logger logger = Logger.getLogger(checkDF_Total_InfoAction.class);
	public checkDF_Total_InfoAction() {
		super();
	}

	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
	}
	
	public void init() throws ServletException {
		// Put your code here
	}
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request,response);

	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html");
		request.setCharacterEncoding("utf-8");
		
		String year_month =request.getParameter("year_month");
		
		logger.info("代发数据核对");
		HttpSession session=request.getSession();
		
		if(year_month.equals("") || year_month == null){
			session.setAttribute("check_DFGZ_Total", null);
		}else{
			CZGZ_DWXX_TOTAL check_DFGZ_Total=new CZGZ_DWXX_TOTAL();
			GongziDWImpl gzmx = new GongziDWImpl();
			check_DFGZ_Total = gzmx.getGZDWCount(year_month);
			if(check_DFGZ_Total.getDF_GZ_TOTAL() == null || check_DFGZ_Total.getDF_GZ_TOTAL() == ""){
				session.setAttribute("check_DFGZ_Total", null);
			}else{
				session.setAttribute("check_DFGZ_Total", check_DFGZ_Total);
			}
			session.setAttribute("year_month",year_month);
		}
		//request.getRequestDispatcher("checkDF_Total_Info.jsp").forward(request, response);//转发
		response.sendRedirect("checkDF_Total_Info.jsp");//重定向
		
	}
}